package com.example.cart_system.pojo;

import lombok.Data;

@Data
public class Result<T> {
    private int code;
    private String msg;
    private T data;

    public Result<T> success(T data) {
        this.code = 1;
        this.msg = "success";
        this.data = data;
        return this;
    }

    public Result<T> success(String msg) {
        this.code = 1;
        this.msg = msg;
        return this;
    }

    public Result<T> error(String msg) {
        this.code = 0;
        this.msg = msg;
        return this;
    }
}
